<?php
/**
 * Created by PhpStorm.
 * User: liujun
 * Date: 2018/8/10
 * Time: 下午2:30
 */

namespace PddWechat\Models\Pddorder\Data;


use PddWechat\Models\Pddorder\Dao\PddOrderDao;
use PddWechat\Models\Pddorder\DataObject\PddOrderDo;

class PddOrderData
{
    public function __construct()
    {
        $this->pddOrderDao = new PddOrderDao();
    }

    /**
     * @param PddOrderDo $pddOrderDo
     * @return PddOrderDo
     */
    public function insert( PddOrderDo $pddOrderDo )
    {
    return $this->pddOrderDao->insert($pddOrderDo);
    }


    /**
     * @param $orderSn
     * @return PddOrderDo
     */
    public function selectByOrderId( $orderSn ){
        /** @var PddOrderDo $res */
        $res = $this->pddOrderDao->selectByOrderId($orderSn);
        return $res;
    }

    /**
     * @param PddOrderDo $pddOrderDo
     * @param null $where
     * @return bool|mixed
     */
    public function edit( PddOrderDo $pddOrderDo, $where=null){
        return $this->pddOrderDao->edit($pddOrderDo, $where);
    }

    public function totalObj(PddOrderDo $pddOrderDo=null) {
        return $this->pddOrderDao->totalObj($pddOrderDo);
    }

    public function selectList(PddOrderDo $pddOrderDo=null, $orderBy=""){
        return $this->pddOrderDao->selectList($pddOrderDo, $orderBy);
    }

    public function selectOwnList($uid,$params) {
        return $this->pddOrderDao->selectOwnList($uid,$params);
    }

    public function selectOwnSpreadList($uid,$params) {
        return $this->pddOrderDao->selectOwnSpreadList($uid,$params);
    }

    public function selectIncome(int $uid,$beginTime,$endTime) {
        return $this->pddOrderDao->selectIncome($uid,$beginTime,$endTime);
    }

    public function selectDirectUserIncome(int $uid) {
        return $this->pddOrderDao->selectDirectUserIncome($uid);
    }

    public function selectAllSpreadList($uid,$params) {
        return $this->pddOrderDao->selectAllSpreadList($uid,$params);
    }

    public function selectByOrderStatus(int $orderStatus) {
        return $this->pddOrderDao->selectByOrderStatus($orderStatus);
    }

    public function updateFlagOrderId(int $orderId) {
        return $this->pddOrderDao->updateOrderStatusByOrderId($orderId);
    }
}